import React from "react";
import { Button, Popover, Spin } from "antd";
import styles from "./index.less";

const ExportBtn = ({ exportExcel = () => {}, loading }) => {
  const content = (
    <div style={{ fontSize: 14, marginLeft: -16, marginRight: -16 }}>
      <Spin spinning={loading}>
        <div className={styles.hoverPop} onClick={() => exportExcel("all")}>
          导出全部
          <span style={{ fontSize: 12 }}>(当前过滤条件下所有明细)</span>
        </div>
        <div className={styles.exportSel} onClick={() => exportExcel("part")}>
          导出所选
        </div>
      </Spin>
    </div>
  );
  return (
    <Popover placement="bottomLeft" content={content} trigger="click">
      <Button type="primary">导出</Button>
    </Popover>
  );
};

export default ExportBtn;
